﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MadLibrary.Collections;

namespace MadLibrary.Web
{
    /// <summary>
    /// Holds and manages multiply CSS properties.
    /// </summary>
    public class CssProperties : Collection<CssProperty>
    {
        /// <summary>
        /// Creates new empty collection of CSS properties.
        /// </summary>
        public CssProperties() : base()
        { 
            
        }
        /// <summary>
        /// Creates new collection of CSS properties with specified default properties.
        /// </summary>
        /// <param name="properties">Specifies properties which have to be added defaultly.</param>
        public CssProperties(params CssProperty[] properties) : base(properties)
        {

        }
        
        /// <summary>
        /// Gets or sets CSS property by specified name.
        /// </summary>
        /// <param name="name">Specifies name of CSS property which must be selected.</param>
        /// <returns>CssProperty with specified name.</returns>
        public CssProperty this[string name]
        {
            get
            {
                return this[this.LastIndexOf(new CssProperty(name))];
            }
            set
            {
                this[this.LastIndexOf(new CssProperty(name))] = value;
            }
        }
    }
}
